﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyQuangCao
{
    public partial class frmGD_NV_Edit : Form
    {
        public string pMaNV = "";
        public string pTenNV = "";
        public bool pchkTT = false;

        public frmGD_NV_Edit()
        {
            InitializeComponent();
        }


        private void btnDY_Click(object sender, EventArgs e)
        {
            bool tsTT=chkTT.Checked;
            string sql = "update nhanvien" + " set Trang_Thai ='" + tsTT + "'"  + "where Ma_Nhan_Vien= '" + pMaNV + "'";
            SqlConnection sc = new SqlConnection(frmChinh.me.sqlcon);
            SqlCommand sqlCmd = new SqlCommand(sql, sc);
            sc.Open();
            sqlCmd.ExecuteNonQuery();
            sc.Close();
            MessageBox.Show("Bạn Đã Cập Nhật Thành Công", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }

        private void frmGD_NV_Edit_Load(object sender, EventArgs e)
        {
            prvSetData();
            txtMaNV.Enabled = false;
            txtTenNV.Enabled = false;
        }
        public void prvSetData()
        {
            txtMaNV.Text = pMaNV;
            txtTenNV.Text = pTenNV;
            chkTT.Checked = pchkTT;
        }

    }
}
